﻿using System.Diagnostics.CodeAnalysis;

namespace DimensionsHelper.LanguageService.Syntax;

public class PreEmptyExpression : PreExpression
{
    internal PreEmptyExpression(int position) :
        base(SyntaxKinds.EmptyExpression)
    {
        Update(position, position + 1);
    }

    internal PreEmptyExpression(SourceNode? parent, int position) :
        base(parent, SyntaxKinds.EmptyExpression)
    {
        Update(position, position + 1);
    }

    public override bool IsEmpty => true;


    public static PreEmptyExpression DefaultEmptyExpression { get; } = new(0);


    public static bool IsNullOrDefaultEmptyExpression([NotNullWhen(false)] PreExpression? expression)
    {
        return expression == null || expression.IsEmpty;
    }
}


public static partial class NodeFactory
{
    public static PreEmptyExpression CreatePreEmptyExpression(int position)
    {
        return new PreEmptyExpression(position);
    }

    public static PreEmptyExpression CreatePreEmptyExpression(SourceNode? parent, int position)
    {
        return new PreEmptyExpression(parent, position);
    }
}